package com.scm.pojo;

import com.scm.pojo.ScmUser;
import com.scm.service.UserModelService;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName UtilUser
 * @Description TODO
 * @Author Xu
 * @Date 2021/7/6 20:45
 * @Version 1.0
 **/

@Data
@Component
public class UtilUser {

    @Autowired
    private UserModelService userModelService;

    public List<ScmUser> setModel(List<ScmUser> list){
        for (ScmUser user: list){
            //获取 用户相对应的权限对象集合
            user.setPower(userModelService.getUserModel(user.getAccount()));

            for (UserModel userModel:user.getPower()){
                UserModel.changeModelName(userModel);
            }

            if (user.getStatus().equals("1")){
                user.setStatus("未锁定");
            }else {
                user.setStatus("已锁定");
            }
        }
        return list;
    }
}
